$(function () {
    if(userid == null || userid == ''){
        alertSupplyLogin()
        return;
    }
    initData("", "");
});
var pageNum = 0;
function initData(orderStatus, shipStatus) {
    jQuery("#orders").html("");
    jQuery.ajax({
        url: server_url + "/rest/sellerOrder/getOrders.do",
        data: {sellerUserId: userid, orderStatus: orderStatus, shipStatus: shipStatus},
        success: function (data) {
            console.log(data);
            if (data.data.length > 0) {
                mapIfExist(function (order) {
                    var html = ' <div class="gray"></div>\
                        <div class="pos_det" onclick="toOrderDetail(\'' + order.id + '\'">\
                    <p class="order_num">订单号：'+order.orderCode+' <span>'+order.orderStatusName+'</span></p>\
                    <div class="det_con">\
                    <img src="'+order.lstOrderDetail[0].picPath+'" alt="" class="">\
                    <div class="">\
                    <div class="con_tit">\
                    <p>'+order.lstOrderDetail[0].productName+'</p>\
                    <span>¥'+order.lstOrderDetail[0].productPrice+'/头</span>\
                    </div>\
                    <p class="con_normal">类别：'+order.lstOrderDetail[0].spec+' <span><i>X</i>' + order.lstOrderDetail[0].productNum + '</span></p>\
                    </div>\
                    <div class="ps_det">合计：¥'+order.price+'</div>\
                    </div>\
                    </div>\
                    <div class="total_box">\
                    <div onclick="toOrderDetail(\'' + order.id + '\')">查看详情</div>\
                    <span onclick="window.location.href=\'tel:4008637797\'">联系客服</span>\
                    </div>';
                    $("#orders").append(html);
                }, data.data);
            } else {
                if (orderStatus == "" && shipStatus == "") {
                    jQuery("<div>" +
                    "<p style='font-size:0.35rem; padding:50% 5% 50% 5%; text-align:center;'>您暂时还没有交易订单!</p>" +
                    "</div>").appendTo($("#art"));
                }

            }

        }
    });
}
function toOrderDetail(orderid) {
    window.location.href = server_url + "supply/product/detail.do?orderid=" + orderid;
}